using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Utility;

namespace MKDS_Course_Editor
{
    public partial class POIT : Form
    {
        public nkm.POIt item = null;
        public POIT(nkm.POIt i)
        {
            InitializeComponent();
            item = i;
        }

        private void POIT_Load(object sender, EventArgs e)
        {
            numericUpDown9.Value = Convert.ToDecimal(item.X);
            numericUpDown8.Value = Convert.ToDecimal(item.Y);
            numericUpDown7.Value = Convert.ToDecimal(item.Z);
            numericUpDown1.Value = Convert.ToDecimal(item.Nr);
            textBox1.Text = BitConverter.ToString(item.Setting1).Replace("-","");
            textBox2.Text = BitConverter.ToString(item.Setting2).Replace("-", "");
        }
        byte[] stringtobyte(string a)
        {
            byte[] buffer;
            int discarded;
            buffer = HexEncoding.GetBytes(a, out discarded);
            return buffer;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            item.X = (float)numericUpDown9.Value;
            item.Y = (float)numericUpDown8.Value;
            item.Z = (float)numericUpDown7.Value;
            item.Nr = (int)numericUpDown1.Value;
            item.Setting1 = stringtobyte(textBox1.Text);
            item.Setting2 = stringtobyte(textBox2.Text);
            MKDS_Course_Editor.nkm.item = item;
            this.Close();
        }
    }
}
